package cn.itcast.bos.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import cn.itcast.bos.dao.SubAreaRepository;
import cn.itcast.bos.domain.base.SubArea;
import cn.itcast.bos.service.SubAreaService;
@Service
@Transactional
public class SubAreaServiceImpl implements SubAreaService {
	@Autowired
	private SubAreaRepository subAreaRepository;
	@Override
	public void save(SubArea model) {
		subAreaRepository.save(model);
	}
	
	//有条件分页查询
	@Override
	public Page<SubArea> findalls(Specification<SubArea> specification, Pageable pageable) {
		return subAreaRepository.findAll(specification,pageable);
	}
	//无条件查询
	@Override
	public Page<SubArea> findPageDate(Pageable pageable) {
		// TODO Auto-generated method stub
		return subAreaRepository.findAll(pageable);
	}
	//导入
	@Override
	public void saveSubAreas(List<SubArea> listSubAreas) {
		subAreaRepository.save(listSubAreas);
		
	}

}
